#pragma once

#include "CoreMinimal.h"
#include "Widgets/SCompoundWidget.h"


class SContentTextItem : public SCompoundWidget
{
public:
	DECLARE_DELEGATE_ThreeParams(FOnSelectionChanged,const bool /*bSelected*/, SContentTextItem* /*ContentTextItem*/, const FString& /*Content*/);
private:
	FReply DoClickItem(const FGeometry& MyGeometry, const FPointerEvent& MouseEvent);
	void UpdateInfo();
public:
	/** Default constructor. */
	SContentTextItem() {}

	/** Virtual destructor. */
	virtual ~SContentTextItem() {}

	SLATE_BEGIN_ARGS(SContentTextItem)
	{}
	SLATE_ATTRIBUTE(FString, ContentText)
	SLATE_EVENT(FOnSelectionChanged, OnSelectionChanged)
	SLATE_END_ARGS()

	/** Constructs this widget. */
	void Construct(const FArguments& InArgs);

	void SetDefaultColor();
	const FLinearColor GetItemColor();

protected:
	TAttribute<FString> ContentText;

	FLinearColor DefaultColor;
	double StartTime;
	int32 Index = 0;

	FOnSelectionChanged OnSelectionChanged;

	TSharedPtr<SBorder> SelectBorder;
	TSharedPtr<STextBlock> TimeTextWidget;
	TSharedPtr<STextBlock> ContentIndexWidget;

};